import React from 'react'
import { useSelector, useDispatch } from 'react-redux'
import lsSlice from '../lsRedux/lsSlice'

const { setMsg } = lsSlice.actions

export default function Msg() {
  const msg = useSelector((state) => {
    return state.ls.msg
  })
  const dispatch = useDispatch()
  return (
    <div>
      <h1>Msg</h1>
      <p>{msg}</p>
      <button
        onClick={() => {
          dispatch(setMsg('yyyy'))
        }}
      >
        修改msg
      </button>
    </div>
  )
}
